#include "CDisplayDescriptor.h"


CDisplayDescriptor::CDisplayDescriptor(void):IDescriptorData(DESCRIPTOR_TAG_ADVERTISEMENT)
, m_wNetworkId(0xFFFF)    	
, m_wTsId(0xFFFF) 
, m_wServiceId(0xFFFF)
, m_dwLocationMask(0)
{	
	m_startTime = time (NULL);
	m_endTime = time(NULL);

}

CDisplayDescriptor::~CDisplayDescriptor(void)
{
}

void CDisplayDescriptor::GetData(BYTE* buff  , int &len)
{
	CBuffer stBuffer(buff, DESCRIPTOR_MAXLEN);

	PACK_DESCRIPTOR_BUFFER_START(stBuffer, DESCRIPTOR_TAG_ADVERTISEMENT);

	BYTE aucTime[5] = {0, };
	ConvertTimeToUTC(m_startTime, aucTime);
	stBuffer.Write(aucTime, 5);
	memset(aucTime, 0xFF, sizeof(aucTime));
	ConvertTimeToUTC(m_endTime, aucTime);
	stBuffer.Write(aucTime, 5);

	stBuffer.Write(m_wNetworkId);
	stBuffer.Write(m_wTsId);
	stBuffer.Write(m_wServiceId);
	stBuffer.Write(m_dwLocationMask);

	len = PACK_DESCRIPTOR_BUFFER_END(stBuffer);
}